log using "C:\Users\mjoshi2\Desktop\ISA2011\ISA2011 conference\ISADATADOFILES\LogFeb11.smcl", replace
set memory 200m
//ND Desktop
use "C:\Users\mjoshi2\Desktop\ISA2011\ISA2011 conference\ISADATADOFILES\isa_2011.dta" 
set more off
//ND Desktop
//use "C:\Users\mjoshi2\Desktop\isa_2011.dta" 
//Home PC
//use "/Users/madhavjoshi/Desktop/joshi.dta"
//MACBOOK
//use "/Users/madhavjoshi/Desktop/ISA2011DAT&DO/isa_2011.dta"
stset year, id(caseid) failure(polity_3change) origin(time year)
//W " Winning Coalition size"//
gen W=0 
replace W=W+1 if (xrcomp>=2)
replace W=W+1 if (xropen>2)
replace W=W+1 if parcomp==5 
gen W_extend = W

//Governmental Incompatibility//
gen gov_incomp = 1 if incompatibility ==0
replace gov_incomp = 0 if gov_incomp==.

//Ethnic Conflicts with governmental incompatibility//
gen ethnic_gov_incomp = ethnic*gov_incomp

//Cold War =1 if year>1989//

gen coldwar = 1 if year>1989

replace coldwar = 0 if coldwar==.

//Generate Ethnic Fractionalization Square//
gen el_2 = el*el

//Generate log of battle death//
gen ln_battledeath = ln(battledeath)

//Generate ethnic conflict that secured territorial autonomy//
gen ethnic_autonomy = ethnic*cult_geo_auto

//Generate log of GDP Lag (lagged by one year)//
gen ln_gdplag = ln(gdplag)

//Generate log of population//
gen ln_pop = ln(pop)


//TRANSITION TOWARD DEMOCRACY 3 POINT CHANGE IN POLITY SCORE
// Weibull Models 
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
//log normal models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
//log logestic models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic

//exponential models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
//cox models
stcox nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
//Log Normal Models used in the Analysis//
eststo: quietly streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)

//esttab using polity3.rtf, title(Table 2: Transition toward Democracy after Civil Wars, 1946-2005.\label{tab1})se compress star(* 0.10 ** 0.05 *** 0.01 **** 0.001) replace
eststo clear


drop _st _d _origin _t _t0

//Holding of Elections as dependent variable//

stset year, id(caseid) failure(pcw_elecction) origin(time year)

//Weibull Models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(w) time cluster(ccode)
estat ic
//Log Normal Models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
estat ic

//Log Logistic Models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ll) time cluster(ccode)
estat ic

//Exponential Models
streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic
streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(e) time cluster(ccode)
estat ic

//Cox Models
stcox nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic
stcox nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, cluster(ccode)
estat ic

//Models for Post-Conflict Elections After Civil Wars//

eststo: quietly streg nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, dist(ln) time cluster(ccode)

//esttab using elections-postwar.rtf, title(Table 2: Post-War Elections after Civil Wars, 1946-2005.\label{tab1})se compress star(* 0.10 ** 0.05 *** 0.01 **** 0.001) replace
eststo clear

drop _st _d _origin _t _t0

//Models of Survival of Peace

stset year, id(peaceid) failure(peacefailure) origin(time year)

//weibull Models
streg W nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, dist(w) time cluster(ccode)
estat ic

//LogNormal Model
streg W nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
estat ic

//log logistic models
streg W nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, dist(ll) time cluster(ccode)
estat ic

//exponential models
streg W nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic
streg W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, dist(e) time cluster(ccode)
estat ic

//cox modedels
stcox W nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, cluster(ccode)
estat ic
stcox W nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo,  cluster(ccode)
estat ic
stcox W nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo,  cluster(ccode)
estat ic
stcox W nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, cluster(ccode)
estat ic
stcox W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, cluster(ccode)
estat ic
stcox W nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo,cluster(ccode)
estat ic
stcox W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, cluster(ccode)
estat ic
//Survival of Peace after Civil War LogNormal Model//
eststo: quietly streg W nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)

//Add on war and gdp growth lag variable in the model
eststo: quietly streg W nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo  gdpgrowlag on_war, dist(ln) time cluster(ccode)

eststo: quietly streg W nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo  gdpgrowlag on_war, dist(ln) time cluster(ccode)
streg W nego_settl rebel_v  unops oil coldwar  ln_gdplag  gdpgrowlag, dist(ln) time cluster(ccode)
eststo: quietly streg W nego_settl rebel_v  unops coldwar pastdemo  gdpgrowlag on_war, dist(ln) time cluster(ccode)
streg W nego_settl rebel_v  unops ethnic coldwar pastdemo  gdpgrowlag  ln_gdplag on_war, dist(ln) time cluster(ccode)
//esttab using peace-survival.rtf, title(Table 2: Post-War Elections after Civil Wars, 1946-2005.\label{tab1})se compress star(* 0.10 ** 0.05 *** 0.01 **** 0.001) replace
eststo clear

gen W_mediate = W*mediate
gen W_observe = W*observe
gen W_tradpko = W*tradpko
gen W_enforce = W*enforce
gen W_multipko = W*multipko
gen W_pko = W*pko
gen W_monitor = W*monitor
gen W_unops = W*unops

streg W W_mediate nego_settl rebel_v  mediate gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
streg W W_observe nego_settl rebel_v  observe gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
streg W W_tradpko nego_settl rebel_v  tradpko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
streg W W_multipko nego_settl rebel_v  multipko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
streg W W_pko nego_settl rebel_v  pko gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
streg W W_monitor nego_settl rebel_v  monitor gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)
streg W W_unops nego_settl rebel_v  unops gov_incomp ethnic oil coldwar pastdemo, dist(ln) time cluster(ccode)

//drop _st _d _origin _t _t0

//Penal Regression Models for Size of Governing Coalition for Next Five Years after Civil Wars
//drop if drop==1
xtset year
eststo: quietly xtreg W nego_settl rebel_v intervention mediate gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention observe gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention tradpko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention enforce gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention multipko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention pko gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention monitor gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe
eststo: quietly xtreg W nego_settl rebel_v intervention unops gov_incomp ethnic wardur ln_battle ln_pop ln_gdplag oil pastdemo, fe

//esttab using winning-coalition.rtf, title(Table 2: Post-War Elections after Civil Wars, 1946-2005.\label{tab1})se compress star(* 0.10 ** 0.05 *** 0.01 **** 0.001) replace
eststo clear

log close

